//
//  JBChineseAndPinYin.h
//  JBPinYin
//
//  Created by YongbinZhang on 7/10/13.
//  Copyright (c) 2013 JustBen. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "pinyin/pinyin.h"

#ifndef ChineseAndPinYinKey
#define ChineseAndPinYinKey
#define ChineseAndPinYinKeyPinYin     @"pinyin"
#define ChineseAndPinYinKeyChinese    @"chinese"
#endif

#ifndef SortedChineseAndPinYinKey
#define SortedChineseAndPinYinKey
#define SortedChineseAndPinYinKeyChar   @"char"
#define SortedChineseAndPinYinKeyValue  @"value"
#endif


@interface JBChineseAndPinYin : NSObject


//  拼音与中文对照数组
/*
[
    {
        pinyin:bBbb
        chinese:bB拜拜
    },
    {
        pinyin:BBbb
        chinese:BB拜拜
    },
    {
        pinyin:12bs
        chinese:12白色
    },
    {
        pinyin:yb
        chinese:拥抱
    },
    {
        pinyin:yl
        chinese:原来
    }
 }
 */
/***************************************************
 *@Description:将中文字符串数组转换为拼音与中文一一对应的字典数组
 *@Params:
 *  ChineseDataSource:中文字符串数组
 *@Return:拼音与中文的字典数组
 ***************************************************/
+ (NSArray *)ChineseAndPinYinArrayFromChineseDataSource:(NSArray *)ChineseDataSource;


/*
 [
    {
        char:B
        value:[
            {
                pinyin:bBbb
                chinese:bB拜拜
            },
            {
                pinyin:BBbb
                chinese:BB拜拜
            }
        ]
    }
    {
        char:Y
        value:[
            {
                pinyin:yb
                chinese:拥抱
            },
            {
                pinyin:yl
                chinese:原来
            }
        ]
    }
    {
        char:#
        value:
        [
            {
                pinyin:1aa
                chinese:1啊啊
            },
            {
                pinyin:1Aa
                chinese:1A阿
            }
        ]
    }
 }
 */
/***************************************************
 *@Description:将中文字符串数组转换为拼音与中文一一对应的
               字典数组并按照拼音排序
 *@Params:
 *  ChineseDataSource:中文字符串数组
 *@Return:拼音与中文的字典数组并按照拼音排序
 ***************************************************/
+ (NSArray *)SortedChineseAndPinYinArrayFromChineseDataSource:(NSArray *)ChineseDataSource;


@end



@interface NSDictionary (PinYin)

/*
 {
 pinyin:1aa
 chinese:1啊啊
 }
 根据pingyin字段排序
 */
- (NSComparisonResult)compareChineseAndPinYin:(NSDictionary *)otherDictionary;

/*
 {
 char:A
 value:
 [
 {
 pinyin:aa
 chinese:啊啊
 },
 {
 pinyin:Aa
 chinese:A阿
 }
 ]
 }
 根据char字段排序
 */
- (NSComparisonResult)compareChineseAndPinYinDic:(NSDictionary *)otherDicationary;


@end
